import time

from selenium import webdriver

from Lib.zcm.rf.ZCM import ZCM
from .check_box import CheckBox
from ...common.ui.Selector import Selector


def test_checkbox_antd3x():
    browser = webdriver.Chrome()
    browser.maximize_window()
    browser.get("https://3x.ant.design/components/checkbox-cn/")

    # 单个
    select = CheckBox(browser, '//section[@id="components-checkbox-demo-basic"]/section/label[contains(@class,"ant-checkbox-wrapper")]', Selector.XPATH)
    select.setValue('True')

    # 一组
    select = CheckBox(browser,
                      '//section[@id="components-checkbox-demo-group"]//div[@class="ant-checkbox-group"]',
                   Selector.XPATH)
    select.setValue('Apple', 'Pear')
    time.sleep(10)

    select.setValue('Orange')
    time.sleep(10)
    browser.close()

def test_zcm():
    zcm = ZCM()
    zcm.openBrowser("https://3x.ant.design/components/checkbox-cn/")
    zcm.set_value('//section[@id="components-checkbox-demo-basic"]/section/label[contains(@class,"ant-checkbox-wrapper")]', 'True')